Skip to content

Simplify module usage by wrapping deferred objects - #117

Open
deric wants to merge 6 commits into
voxpupuli:masterfrom
deric:kv
Open

Simplify module usage by wrapping deferred objects#117
deric wants to merge 6 commits into
voxpupuli:masterfrom
deric:kv

Conversation

@deric

@deric deric commented Feb 19, 2025

Copy link
Copy Markdown

Simplify module usage by a wrapper function.

Instead of

$d = Deferred('vault_lookup::lookup', ['secret/test', 'https://vault.hostname:8200'])

use

$d = vault_lookup::kv('secret/test')

where appropriate Vault server can be retrieved from Hiera:

---
vault_lookup::server: 'https://vault.hostname:8200'

the code becomes:

$d = vault_lookup::kv('secret/test', {'vault_addr' => 'https://vault.hostname:8200'})

Additionally there's a vault_lookup::fmt() function for deferred formating:

vault_lookup::fmt('password=%<pass>s', {'pass' => $d })

@deric deric changed the title Implement wrapper around deferred function call Simplify module usage by wrapping deferred objects Feb 20, 2025
@tskirvin

Copy link
Copy Markdown

This looks pretty good if it works!

@deric

deric commented Feb 26, 2025

Copy link
Copy Markdown
Author

@tskirvin It does work 😃 Just the fmt function seems to be limited to Puppet >=8 - somehow deferred unwrap doesn't work well with Puppet 7.

deric added 4 commits January 18, 2026 10:19
Simplify module usage by a wrapper function.

Instead of
```puppet
$d = Deferred('vault_lookup::lookup', ["secret/test", 'https://vault.hostname:8200'])
```

use
```puppet
$d = vault_lookup::kv('secret/test', 'https://vault.hostname:8200')
```
Deferred sprint evaluation
@deric

deric commented Jan 18, 2026

Copy link
Copy Markdown
Author

@bastelfreak Could you please have a look at this? Since puppet/openvox 7.x is no longer supported this should work.

Is it ok to write Puppet functions? Or should I rewrite it into Ruby API?

@bastelfreak

Copy link
Copy Markdown
Member

Puppet functions are preferred over ruby functions. I will try to take a look later.

@deric

deric commented Jan 19, 2026

Copy link
Copy Markdown
Author

@bastelfreak Any particular reason? Performance? or just consistency? Functions have been rewritten into ruby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants